<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
    <table width="100%" style="border-collapse:collapse;" border="1" cellpadding="2">
      <xsl:apply-templates select="/forum_home/Category"></xsl:apply-templates>
    </table>
  </xsl:template>

  <xsl:template match="/forum_home/Category">
    <tr  style="height:32px;background:#add8e6;">
      <td colspan="5">
        <b>
            <xsl:value-of select="CatName"></xsl:value-of>&#160;
        </b>
        <a>
          <xsl:attribute name="href">/desktops/forum/rss.aspx</xsl:attribute>
          <img src="/images/rss2.gif" border="0" />
        </a>
      </td>
    </tr>
    <tr>
      <td style="text-align:center;width:5%;background:#E7EBF7;">
        -
      </td>
      <td style="width:45%;background:#E7EBF7;text-align:center;">
        <b>Diễn đàn</b>
      </td>
      <td style="width:40%;background:#E7EBF7;text-align:center;">
        <b>Bài mới nhất</b>
      </td>
      <td style="width:5%;background:#E7EBF7;text-align:center;">
        <b>Chủ đề</b>
      </td>
      <td style="width:5%;background:#E7EBF7;text-align:center;">
        <b>Bài</b>
      </td>
    </tr>
    <xsl:apply-templates select="Forum"></xsl:apply-templates>
  </xsl:template>

  <xsl:template match="Forum">
    <tr>
      <td style="text-align:center;">
        <img>
          <xsl:attribute name="src">
            <xsl:if test="/forum_home/root_folder!=''">
              <xsl:value-of select="/forum_home/root_folder"></xsl:value-of>
            </xsl:if>/images/folder.gif
          </xsl:attribute>
        </img>
      </td>
      <td>
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="link"></xsl:value-of>
          </xsl:attribute>
          <xsl:value-of select="Name"></xsl:value-of>
        </a>
        <br/>
        <xsl:value-of select="Description"></xsl:value-of>
      </td>
      <td>
        <xsl:if test="UserName!=''">
          <a>
            <xsl:attribute name="href">
              <xsl:value-of select="topic_url"></xsl:value-of>
            </xsl:attribute>
            <xsl:value-of select="TopicName"></xsl:value-of>
          </a>
          <br />
          <a>
            <xsl:attribute name="href">
              <xsl:value-of select="mem_url"></xsl:value-of>
            </xsl:attribute>
            <b>
              <xsl:value-of select="UserName"></xsl:value-of>
            </b>
          </a>
          (<xsl:value-of select="PostedDate"></xsl:value-of>)
        </xsl:if>
      </td>
      <td style="text-align:center;">
        <xsl:value-of select="TotalTopic"></xsl:value-of>
      </td>
      <td style="text-align:center;">
        <xsl:value-of select="TotalReply"></xsl:value-of>
      </td>
    </tr>
  </xsl:template>
    
</xsl:stylesheet>

